#if !defined(ximera_xml_xmlelement_hpp)
#define ximera_xml_xmlelement_hpp

// -----------------------------------------------------------

#include <ximera/xml/xmlnode.hpp>

#include <map>

namespace ximera { namespace xml
{
    class XIMERA_API XmlElement : public XmlNode
    {
    private:
        typedef std::map<String, String> AttributeMap;

    public:
        typedef AttributeMap::iterator AttributeIterator;
        typedef AttributeMap::const_iterator AttributeConstIterator;

    public:
        virtual XmlNodeType type() const { return XmlNodeType::Element; }

        String const& attribute(String const& name);
        bool attribute(String const& name, String& value) const;
        void attribute(String const& name, String const& value);

        void removeAttribute(String const& name);
        void removeAttribute(AttributeIterator attr);

        AttributeIterator attributeBegin() { return _attributes.begin(); }
        AttributeConstIterator attributeBegin() const { return _attributes.begin(); }

        AttributeIterator attributeEnd() { return _attributes.end(); }
        AttributeConstIterator attributeEnd() const { return _attributes.end(); }

        String retrieveText() const;

    private:
        AttributeMap _attributes;
    };
}}

// -----------------------------------------------------------

#endif